package cn.powerone.scm.service.impl;

import java.util.List;
import cn.powerone.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.powerone.scm.mapper.ScmAttachmentTemplateMapper;
import cn.powerone.scm.domain.ScmAttachmentTemplate;
import cn.powerone.scm.service.IScmAttachmentTemplateService;

/**
 * 全局附件模板Service业务层处理
 * 
 * @author PowerOne
 * @date 2025-09-10
 */
@Service
public class ScmAttachmentTemplateServiceImpl implements IScmAttachmentTemplateService 
{
    @Autowired
    private ScmAttachmentTemplateMapper scmAttachmentTemplateMapper;

    /**
     * 查询全局附件模板
     * 
     * @param id 全局附件模板主键
     * @return 全局附件模板
     */
    @Override
    public ScmAttachmentTemplate selectScmAttachmentTemplateById(Long id)
    {
        return scmAttachmentTemplateMapper.selectScmAttachmentTemplateById(id);
    }

    /**
     * 查询全局附件模板列表
     * 
     * @param scmAttachmentTemplate 全局附件模板
     * @return 全局附件模板
     */
    @Override
    public List<ScmAttachmentTemplate> selectScmAttachmentTemplateList(ScmAttachmentTemplate scmAttachmentTemplate)
    {
        return scmAttachmentTemplateMapper.selectScmAttachmentTemplateList(scmAttachmentTemplate);
    }

    /**
     * 新增全局附件模板
     * 
     * @param scmAttachmentTemplate 全局附件模板
     * @return 结果
     */
    @Override
    public int insertScmAttachmentTemplate(ScmAttachmentTemplate scmAttachmentTemplate)
    {
        scmAttachmentTemplate.setCreateTime(DateUtils.getNowDate());
        return scmAttachmentTemplateMapper.insertScmAttachmentTemplate(scmAttachmentTemplate);
    }

    /**
     * 修改全局附件模板
     * 
     * @param scmAttachmentTemplate 全局附件模板
     * @return 结果
     */
    @Override
    public int updateScmAttachmentTemplate(ScmAttachmentTemplate scmAttachmentTemplate)
    {
        scmAttachmentTemplate.setUpdateTime(DateUtils.getNowDate());
        return scmAttachmentTemplateMapper.updateScmAttachmentTemplate(scmAttachmentTemplate);
    }

    /**
     * 批量删除全局附件模板
     * 
     * @param ids 需要删除的全局附件模板主键
     * @return 结果
     */
    @Override
    public int deleteScmAttachmentTemplateByIds(Long[] ids)
    {
        return scmAttachmentTemplateMapper.deleteScmAttachmentTemplateByIds(ids);
    }

    /**
     * 删除全局附件模板信息
     * 
     * @param id 全局附件模板主键
     * @return 结果
     */
    @Override
    public int deleteScmAttachmentTemplateById(Long id)
    {
        return scmAttachmentTemplateMapper.deleteScmAttachmentTemplateById(id);
    }
}
